package com.ruoyi.caipiao.service.impl;

import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ThreadLocalRandom;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.caipiao.utils.Pl3NumUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.caipiao.mapper.CaipiaoPl3MethodSixMapper;
import com.ruoyi.caipiao.domain.CaipiaoPl3MethodSix;
import com.ruoyi.caipiao.service.ICaipiaoPl3MethodSixService;

/**
 * 方法6预测Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-22
 */
@Service
public class CaipiaoPl3MethodSixServiceImpl extends ServiceImpl<CaipiaoPl3MethodSixMapper, CaipiaoPl3MethodSix> implements ICaipiaoPl3MethodSixService
{
    @Autowired
    private CaipiaoPl3MethodSixMapper caipiaoPl3MethodSixMapper;

    /**
     * 查询方法6预测
     *
     * @param id 方法6预测主键
     * @return 方法6预测
     */
    @Override
    public CaipiaoPl3MethodSix selectCaipiaoPl3MethodSixById(Long id)
    {
        return caipiaoPl3MethodSixMapper.selectCaipiaoPl3MethodSixById(id);
    }

    /**
     * 查询方法6预测列表
     *
     * @param caipiaoPl3MethodSix 方法6预测
     * @return 方法6预测
     */
    @Override
    public List<CaipiaoPl3MethodSix> selectCaipiaoPl3MethodSixList(CaipiaoPl3MethodSix caipiaoPl3MethodSix)
    {
        return caipiaoPl3MethodSixMapper.selectCaipiaoPl3MethodSixList(caipiaoPl3MethodSix);
    }

    /**
     * 新增方法6预测
     *
     * @param caipiaoPl3MethodSix 方法6预测
     * @return 结果
     */
    @Override
    public int insertCaipiaoPl3MethodSix(CaipiaoPl3MethodSix caipiaoPl3MethodSix)
    {
        caipiaoPl3MethodSix.setCreateTime(DateUtils.getNowDate());
        return caipiaoPl3MethodSixMapper.insertCaipiaoPl3MethodSix(caipiaoPl3MethodSix);
    }

    /**
     * 修改方法6预测
     *
     * @param caipiaoPl3MethodSix 方法6预测
     * @return 结果
     */
    @Override
    public int updateCaipiaoPl3MethodSix(CaipiaoPl3MethodSix caipiaoPl3MethodSix)
    {
        caipiaoPl3MethodSix.setUpdateTime(DateUtils.getNowDate());
        return caipiaoPl3MethodSixMapper.updateCaipiaoPl3MethodSix(caipiaoPl3MethodSix);
    }

    /**
     * 批量删除方法6预测
     *
     * @param ids 需要删除的方法6预测主键
     * @return 结果
     */
    @Override
    public int deleteCaipiaoPl3MethodSixByIds(Long[] ids)
    {
        return caipiaoPl3MethodSixMapper.deleteCaipiaoPl3MethodSixByIds(ids);
    }

    /**
     * 删除方法6预测信息
     *
     * @param id 方法6预测主键
     * @return 结果
     */
    @Override
    public int deleteCaipiaoPl3MethodSixById(Long id)
    {
        return caipiaoPl3MethodSixMapper.deleteCaipiaoPl3MethodSixById(id);
    }

    @Override
    public List<CaipiaoPl3MethodSix> checkCode(CaipiaoPl3MethodSix caipiaoPl3MethodSix) {
        return null;
    }

    @Override
    public List<CaipiaoPl3MethodSix> generateCode(CaipiaoPl3MethodSix caipiaoPl3MethodSix) {
        return null;
    }

    @Override
    public Set<String> getCodes() {
        Set<String> set = new TreeSet<>();
        for (int i = 0; i < 10; i++) {
            String randomNum = Pl3NumUtil.getRandomNum(999);
            int i1 = ThreadLocalRandom.current().nextInt(1000);
            if (i1 % 2 == 0) {
                set.add(randomNum);
            }
        }
        return set;
//        return Pl3NumUtil.set2Str(set);
    }
}
